import Vue from 'vue'
import Router from 'vue-router'
import home from '@/views/home'

//登录相关
import login from '@/views/login/login'
import register from '@/views/login/register'
//任务
import taskIndex from '@/views/task/index'
import basic from '@/views/task/basic'
import taskTodo from '@/views/task/todo'
import complete from '@/views/task/complete'
import history from '@/views/task/history'
//许愿池
import desireIndex from '@/views/desire/index'
//设置
import systemIndex from '@/views/system/index'
import addTask from '@/views/system/addTask'
import personList from '@/views/system/personList'
import structure from '@/views/system/structure'
import jobList from '@/views/system/jobList'
//个人中心
import memberIndex from '@/views/member/index'
//资料修改相关
import changeInfo from '@/views/member/changeInfo/index'
import infoList from '@/views/member/changeInfo/infoList'
import password from '@/views/member/changeInfo/password'

Vue.use(Router)

//接口前缀设定
if(document.domain == 'localhost'){
	window.$base = 'http://localhost:3999/';
}else{
	window.$base = 'http://meiyinode.letp.cn/';
}

export default new Router({
	routes: [
		//主导航区
	    {
	        path: '/', component: home,
	        children: [
	            { path: '/taskIndex', name: '首页', component: taskIndex,
	            	children: [
	            		{ path: '/index', name: '概况', component: basic },
	            		{ path: '/task/todo', name: '待办事项', component: taskTodo },
	            		{ path: '/task/complete', name: '已完成', component: complete },
	            		{ path: '/task/history', name: '历史记录', component: history },
	            	]
	            },
	            { path: '/desire', name: '许愿池', component: desireIndex },
	            { path: '/system', name: '系统设置', component: systemIndex,
	            	children: [
	            		{ path: '/system/addTask', name: '任务发布', component: addTask },
	            		{ path: '/system/personList', name: '成员列表', component: personList },
	            		{ path: '/system/structure', name: '组织架构', component: structure },
	            		{ path: '/system/jobList', name: '职位列表', component: jobList },
	            	]
	            },
	            { path: '/member', name: '用户中心', component: memberIndex },
	        ]
	    },
	    //资料修改相关页
	    {
	        path: '/changeInfo', component: changeInfo,
	        children: [
	            { path: '/member/changeInfo/infoList', name: '资料修改', component: infoList },
	            { path: '/member/changeInfo/password', name: '密码修改', component: password },
	        ]
	    },
	    //注册、登录
	    { path: '/login', name: '登录', component: login },
	    { path: '/register', name: '注册', component: register },
	]
})
